package com.yanqu.xiuxian.crosssystem.manger.elementalbonds.result;

import com.yanqu.xiuxian.config.elementalbonds.enums.ElementalBondsOperateType;
import com.yanqu.xiuxian.crosssystem.manger.elementalbonds.data.ElementalBondsGameData;
import com.yanqu.xiuxian.crosssystem.manger.elementalbonds.entity.ElementalBondsOperateEffect;
import com.yanqu.xiuxian.crosssystem.manger.elementalbonds.entity.ElementalBondsOperateShow;

import java.util.ArrayList;
import java.util.List;

public class ElementalBondsOperateResult {

    private int ret = 0;
    private ElementalBondsOperateType elementalBondsOperateType;
    private int skillId = 0;                                                                    // 移动0，卡片技能、盘面技能时为对应ID
    private int turn = 1;                                                                       // 轮到谁了

    private List<ElementalBondsOperateShow> elementalBondsOperateShowList = new ArrayList<>();  // 过程表现

    // 生成炸弹加步数状态
    private int bombAddStepStatus = -1; // 默认-1无法加步数，0未加步数，1已加步数
    private int scene07AddMp = 0;       // 百宝箱加蓝数量

    // 最终盘面
    private ElementalBondsGameData elementalBondsGameData = null;

    public ElementalBondsOperateResult(ElementalBondsOperateType elementalBondsOperateType, boolean stepMax, int turn) {
        this.elementalBondsOperateType = elementalBondsOperateType;
        this.turn = turn;
        if (elementalBondsOperateType == ElementalBondsOperateType.MOVE ||
                !stepMax && elementalBondsOperateType == ElementalBondsOperateType.USE_SKILL) {
            this.bombAddStepStatus = 0;
        }
    }

    public static ElementalBondsOperateResult newSceneRefreshResult(int turn) {
        ElementalBondsOperateResult elementalBondsOperateResult = new ElementalBondsOperateResult(ElementalBondsOperateType.USE_SKILL, true, turn);
        elementalBondsOperateResult.setSkillId(-1);
        return elementalBondsOperateResult;
    }

    public void addElementalBondsOperateShow(ElementalBondsOperateShow elementalBondsOperateShow) {
        this.elementalBondsOperateShowList.add(elementalBondsOperateShow);
    }

    public void addElementalBondsOperateEffect(ElementalBondsOperateEffect elementalBondsOperateEffect) {
        if (elementalBondsOperateShowList.isEmpty() ||
                !elementalBondsOperateShowList.get(elementalBondsOperateShowList.size() - 1).getElementalBondsOperateRoundResultList().isEmpty()) {
            elementalBondsOperateShowList.add(new ElementalBondsOperateShow());
        }
        elementalBondsOperateShowList.get(elementalBondsOperateShowList.size() - 1).addElementalBondsOperateEffect(elementalBondsOperateEffect);
    }

    public void addScene07AddMp(int scene07AddMp) {
        this.scene07AddMp += scene07AddMp;
    }

    public void addElementalBondsOperateRoundResult(ElementalBondsOperateRoundResult elementalBondsOperateRoundResult) {
        if (elementalBondsOperateShowList.isEmpty()) {
            elementalBondsOperateShowList.add(new ElementalBondsOperateShow());
        }
        elementalBondsOperateShowList.get(elementalBondsOperateShowList.size() - 1).addElementalBondsOperateRoundResult(elementalBondsOperateRoundResult);
    }

    public int getRet() {
        return ret;
    }

    public void setRet(int ret) {
        this.ret = ret;
    }

    public ElementalBondsOperateType getElementalBondsOperateType() {
        return elementalBondsOperateType;
    }

    public void setElementalBondsOperateType(ElementalBondsOperateType elementalBondsOperateType) {
        this.elementalBondsOperateType = elementalBondsOperateType;
    }

    public int getSkillId() {
        return skillId;
    }

    public void setSkillId(int skillId) {
        this.skillId = skillId;
    }

    public int getTurn() {
        return turn;
    }

    public void setTurn(int turn) {
        this.turn = turn;
    }

    public List<ElementalBondsOperateShow> getElementalBondsOperateShowList() {
        return elementalBondsOperateShowList;
    }

    public void setElementalBondsOperateShowList(List<ElementalBondsOperateShow> elementalBondsOperateShowList) {
        this.elementalBondsOperateShowList = elementalBondsOperateShowList;
    }

    public int getBombAddStepStatus() {
        return bombAddStepStatus;
    }

    public void setBombAddStepStatus(int bombAddStepStatus) {
        this.bombAddStepStatus = bombAddStepStatus;
    }

    public int getScene07AddMp() {
        return scene07AddMp;
    }

    public void setScene07AddMp(int scene07AddMp) {
        this.scene07AddMp = scene07AddMp;
    }

    public ElementalBondsGameData getElementalBondsGameData() {
        return elementalBondsGameData;
    }

    public void setElementalBondsGameData(ElementalBondsGameData elementalBondsGameData) {
        this.elementalBondsGameData = elementalBondsGameData;
    }

}
